// Clent.js
var http = require('http');
var url = require('url');
var router = require('./module/router.js');

var server = http.createServer(function(req, resp){
    if(req.url != '/favicon.ico'){
        var pathname = url.parse(req.url).pathname;
        pathname = pathname.replace(/\//, '');
        try{
            router[pathname](req, resp);
        }catch(err){
            console.log(err);
            resp.end(err.toString());
        }
    }
});

server.listen(3000, '127.0.0.1');
